var _serviceURL = '/69mark/web';// 必须设置
$(function() {
	doPage(1);
});

function doPage(page){
	var isAuth = $("#auth").val();
	var sex = $("#sex").val();
	var userName = $("#serchName").val();
	$.ajax({
   		type : "POST",
   		url : _serviceURL+"/toListAllUser.do",
   		cache : false,
   		data : "pageNo="+page+"&pageSize=10&isAuth="+isAuth+"&sex="+sex+"&userName="+userName,
   		dataType : 'json',
   		success : function(data) {
   			var result = "";
   			for(var i=0;i<data.menuList.length;i++){
   				result += "<tr>";
   				result += "<td>"+data.menuList[i].nickname+"</td>";
   				result += "<td>"+data.menuList[i].user_name+"</td>";
   				result += "<td>";
   				if (data.menuList[i].live_city!=null) {
   					result += ""+data.menuList[i].live_city+"";
   				}
   				result += "</td>";
   				
   				result += "<td>";
   				if (data.menuList[i].real_name!=null) {
   					result += ""+data.menuList[i].real_name+"";
   				}
   				result += "</td>";
   				
   				if (data.menuList[i].sex == null) {
   					result += "<td>用户未填</td>";
   				}else {
   					result += "<td>"+data.menuList[i].sex+"</td>";
   				}
   				
   				if (data.menuList[i].type == '1') {
   					result += "<td>待审核</td>";
   				}else if (data.menuList[i].type == '2') {
   					result += "<td>通过</td>";
   				}else if (data.menuList[i].type == '0') {
   					result += "<td>无认证信息</td>";
   				}else {
   					result += "<td>不通过</td>";
   				}
   				
   				result += "<td>";
   				result += "<a href=\""+_serviceURL+"/toSecInform.do?userId="+data.menuList[i].user_id+"\" title=\"查看\">查看</a>";
   				result += "<a href=\""+_serviceURL+"/toAuthenticationIndex.do?userId="+data.menuList[i].user_id+"\" style=\"margin-left:10px;\" title=\"审核\">审核</a>";
   				//result += "<a href=\"\" onclick=\"delfuncitem('"+data.menuList[i].user_id+"');return false;\" style=\"margin-left:10px;\" title=\"删除\">删除</a>";
   				result += "</td>";
   				result += "</tr>";
   			}
   			
   			$("#listUser").html(result);
   			$("#page_user").html(data.navi);
   			
   			$("#auth").val("");
   			$("#sex").val("");
   			$("#serchName").val("");
   		}
	})
	
}

//审核状态查询
function authSelect(auth) {
	$("#auth").val(auth);
	doPage(1);
}

//性别查询
function sex(sex) {
	$("#sex").val(sex);
	doPage(1);
}

//用户名查询
function serchName() {
	doPage(1);
}

function delfuncitem(thisid){
    layer.confirm('确定删除？',{btn:['确定','取消']},function(){
        $.ajax({
            type:'POST',
            url:_serviceURL+'/toDeleteUserId.do',
            data:'userId='+thisid,
            dataType : 'json',
            success:function(flag){
                if(flag==1){
                    layer.msg('删除成功',{
                        time: 2000,
                    });
                    doPage(1);
                 }else{
                     layer.msg('删除失败',{
                        time: 2000,
                      });
                 }
             }
         });
      });
 }


